<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ui>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>无标题文档</title>
		<link rel="stylesheet" type="text/css" charset="utf-8"
			href="/hrms/css/styles.css" />
		<link rel="stylesheet" type="text/css" charset="utf-8"
			href="/hrms/css/flexigrid.css" />
		<link rel="stylesheet" type="text/css" charset="utf-8"
			href="/hrms/css/flexigrid.pack.css" />
		<link rel="stylesheet" type="text/css" charset="utf-8"
			href="/hrms/css/ztree.css" />

		<script type="text/javascript"
			src="/hrms/js/jquery-1.7.2.min.js"></script>

		<script type="text/javascript"
			src="/hrms/js/jquery.container.js"></script>

		<script type="text/javascript"
			src="/hrms/js/common.js"></script>

		<script type="text/javascript"
			src="/hrms/js/flexigrid.pack.js"></script>

		<script type="text/javascript">
		
		var setting = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick,
				onCheck: onCheck
			}
		};
		
		var setting_update = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick_update,
				onCheck: onCheck_update
			}
		};
		
		var dept_setting_add = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick_dept_add,
				onCheck: onCheck_dept_add
			}
		};
		
		var dept_setting_update = {
			check: {
				enable: true,
				chkStyle: "radio",
				radioType: "all"
			},
			view: {
				dblClickExpand: false
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				onClick: onClick_dept_update,
				onCheck: onCheck_dept_update
			}
		};
 
		var zRoleNodes =[
			{id:1, pId:0, name:"管理员"},
			{id:2, pId:0, name:"财务部", open:true, nocheck:true},
			{id:21, pId:2, name:"出纳"},
			{id:22, pId:2, name:"会计"},
			{id:4, pId:0, name:"软件研发部", open:true, nocheck:true},
			{id:41, pId:4, name:"岗位经理"},
			{id:42, pId:4, name:"岗位副总"},
			{id:43, pId:4, name:"总助"}
		 ];
		 
		 var zDeptNodes =[
			{id:1, pId:0, name:"总经理办公室"},
			{id:2, pId:0, name:"财务部"},
			{id:4, pId:0, name:"软件研发部"}
		 ];
 
		function onClick(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}
 
		function onCheck(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
				v += nodes[i].name + ",";
			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#parent");
			cityObj.attr("value", v);
		}
		
		function onClick_update(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo_update");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}
		
		function onClick_dept_add(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("dept_treeDemo_add");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}
		
		function onClick_dept_update(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("dept_treeDemo_update");
			zTree.checkNode(treeNode, !treeNode.checked, null, true);
			return false;
		}
 
		function onCheck_update(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("treeDemo_update"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
				v += nodes[i].name + ",";
			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#parent_update");
			cityObj.attr("value", v);
		}
		
		function onCheck_dept_add(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("dept_treeDemo_add"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
				v += nodes[i].name + ",";
			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#deptid_add");
			cityObj.attr("value", v);
		}
		
		function onCheck_dept_update(e, treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("dept_treeDemo_update"),
			nodes = zTree.getCheckedNodes(true),
			v = "";
			for (var i=0, l=nodes.length; i<l; i++) {
				v += nodes[i].name + ",";
			}
			if (v.length > 0 ) v = v.substring(0, v.length-1);
			var cityObj = $("#deptid_update");
			cityObj.attr("value", v);
		}
 
		function showMenu() {
			var cityObj = $("#parent");
			var cityOffset = $("#parent").offset();
			$("#menuContent").slideDown("fast");
 
			$("body").bind("mousedown", onBodyDown);
		}
		
		function hideMenu() {
			$("#menuContent").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown);
		}
		function onBodyDown(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "parent" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
				hideMenu();
			}
		}
		function showMenu_update() {
			var cityObj = $("#parent_update");
			var cityOffset = $("#parent_update").offset();
			$("#menuContent_update").slideDown("fast");
 
			$("body").bind("mousedown", onBodyDown_update);
		}
		
		function showMenu_dept_add() {
			var cityObj = $("#deptid_add");
			var cityOffset = $("#deptid_add").offset();
			$("#dept_menuContent_add").slideDown("fast");
 
			$("body").bind("mousedown", onBodyDown_dept_add);
		}
		
		function showMenu_dept_update() {
			var cityObj = $("#deptid_update");
			var cityOffset = $("#deptid_update").offset();
			$("#dept_menuContent_update").slideDown("fast");
 
			$("body").bind("mousedown", onBodyDown_dept_update);
		}
		
		function hideMenu_update() {
			$("#menuContent_update").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown_update);
		}
		function hideMenu_dept_add() {
			$("#dept_menuContent_add").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown_dept_add);
		}
		
		function hideMenu_dept_update() {
			$("#dept_menuContent_update").fadeOut("fast");
			$("body").unbind("mousedown", onBodyDown_dept_update);
		}
		function onBodyDown_update(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "parent_update" || event.target.id == "menuContent_update" || $(event.target).parents("#menuContent_update").length>0)) {
				hideMenu_update();
			}
		}
		
		function onBodyDown_dept_add(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "deptid_add" || event.target.id == "dept_menuContent_add" || $(event.target).parents("#dept_menuContent_add").length>0)) {
				hideMenu_dept_add();
			}
		}
		
		function onBodyDown_dept_update(event) {
			if (!(event.target.id == "menuBtn" || event.target.id == "deptid_update" || event.target.id == "dept_menuContent_update" || $(event.target).parents("#dept_menuContent_update").length>0)) {
				hideMenu_dept_update();
			}
		}
	//角色功能授权信息
	var func_setting_auth = {
			check: {
				enable: true
			},
			data: {
				simpleData: {
					enable: true
				}
			}
		};
 
		var zFuncNodes =[
			{ id:1, pId:0, name:"系统管理", open:true},
			{ id:11, pId:1, name:"用户管理", open:true},
			{ id:111, pId:11, name:"新增用户"},
			{ id:112, pId:11, name:"修改用户"},
			{ id:113, pId:11, name:"删除用户"},
			{ id:12, pId:1, name:"岗位管理", open:true},
			{ id:121, pId:12, name:"新增岗位"},
			{ id:122, pId:12, name:"岗位修改"},
			{ id:123, pId:12, name:"删除岗位"}
		];
	$(document).ready( function() {
		$.fn.zTree.init($("#treeDemo"), setting, zRoleNodes);
		$.fn.zTree.init($("#treeDemo_update"), setting_update, zRoleNodes);
		
		$.fn.zTree.init($("#dept_treeDemo_add"), dept_setting_add, zDeptNodes);
		$.fn.zTree.init($("#dept_treeDemo_update"), dept_setting_update, zDeptNodes);
		
		$.fn.zTree.init($("#func_treeDemo_auth"), func_setting_auth, zFuncNodes);

		demand("rolemgr");
		$("#add").click(function(){
			$("#role_add").dialog("close");
		});
		$("#update").click(function(){
			$("#role_update").dialog("close");
		});
		$("#btn_auth").click(function(){
			$("#func_auth").dialog("close");
		});
		$("#role_update").dialog("close");
		$("#role_add").dialog("close");
		$("#func_auth").dialog("close");
	});
</script>

	</head>

	<body onload="loadDemand('rolemgr')">
		<div align="center">
			<br />
			<br />
			<br />
			<table width="80%" border="0" class="table_frame" align="center">

				<thead class="table_title" title="岗位信息管理">
					<tr>
						<td align="center">岗位信息管理</td>
					</tr>
				</thead>
				<tr>
					<td>
						<table width="100%" border="0" class="table_block">
							<tr>
								<td align="right">
									岗位编号：
								</td>
								<td align="left">
									<input name="" type="text" size="20" />
									&nbsp;
								</td>
								<td align="right">
									岗位名称：
								</td>
								<td align="left">
									<input name="Input" type="text" size="20" />
								</td>
							</tr>
							<tr>
								<td colspan="4" align="center">
									<input name="" type="button" value="查询" class="button_image" />
									<input name="" type="reset" class="button_image" />
								</td>

							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td height="20"></td>
				</tr>
				<tr>
					<td>
						<div>
							<table id="querylist"></table>
							<script type="text/javascript">
	$("#querylist").flexigrid( {
		url :'post2.php',
		dataType :'json',
		colModel : [ {
			display :'岗位编号',
			name :'iso',
			width :160,
			sortable :true,
			align :'center'
		}, {
			display :'岗位名称',
			name :'name',
			width :180,
			sortable :true,
			align :'left'
		}, {
			display :'上级岗位',
			name :'printable_name',
			width :120,
			sortable :true,
			align :'left'
		}, {
			display :'岗位级别',
			name :'iso3',
			width :130,
			sortable :true,
			align :'left',
			hide :true
		}, {
			display :'岗位性质',
			name :'iso3',
			width :130,
			sortable :true,
			align :'left',
			hide :true
		}, {
			display :'隶属部门',
			name :'numcode',
			width :80,
			sortable :true,
			align :'right'
		},{
			display :'创建日期',
			name :'numcode',
			width :80,
			sortable :true,
			align :'right'
		} ],
		buttons : [ {
			name :'新增岗位',
			bclass :'add',
			onpress :add
		}, {
			name :'岗位编辑',
			bclass :'edit',
			onpress :update
		}, {
			name :'删除岗位',
			bclass :'delete',
			onpress :remove
		}, {
			name :'岗位授权',
			bclass :'auth',
			onpress :auth
		}, {
			separator :true
		} ],
		searchitems : [ {
			display :'岗位编号',
			name :'iso'
		}, {
			display :'岗位名称',
			name :'name',
			isdefault :true
		} ],
		sortname :"iso",
		sortorder :"asc",
		usepager :true,
		title :'岗位信息列表',
		useRp :true,
		rp :15,
		showTableToggleBtn :true,
		width :1000,
		height :200
	});
	function add(com, grid) {
		$("#role_add").dialog("open");
	}
	function update(com, grid) {
		$("#role_update").dialog("open");
	}
	function remove(com, grid) {
		alert("请先选择您要删除的数据！");
	}
	function auth(com,grid){
		$("#func_auth").dialog("open");
	}
</script>
						</div>
					</td>
				</tr>
			</table>
			<div align="center">
				<br />
				<br />
				<table width="90%" border="0" class="table_frame" align="center">
					<tr>
						<td align="center">
							<input id="demand" name="" type="button" value="需求收集"
								class="button_image" />
						</td>
					</tr>
					<tr>
						<td align="center">
							<div id="demand_input" style="display: none">
								<textarea rows="15" cols="120" id="demand_text"></textarea>
								<br />
								<input id="demand_save" type="button" class="button_image"
									value="保存需求" />
							</div>
						</td>
					</tr>
				</table>
				<table id="demand_des" width="90%" border="0" class="table_frame"
					align="center">
					<thead align="center" class="table_title" title="需求描述">
					</thead>
				</table>
			</div>
		</div>
		<ui:dialog id="role_add" title="岗位新增" height="270" width="600"
			modal="true">
			<form id="aform"
				action="/eaip/webservice/resources/session/login"
				method="post">
				<table class="table_frame" width="100%">
					<tr>
						<td align="right">
							岗位编号:
						</td>
						<td align="left">
							<input type="text" id="username" name="userPO.username"
								class="validate[required] text-input" maxlength="128"></input>
							<font color="red">*</font>
						</td>
						<td align="right">
							上级岗位:
						</td>
						<td align="left">
							<input id="parent" type="text" readonly="readonly" size="20" onclick="showMenu();" />
							<div id="menuContent" class="menuContent"
								style="display: none; position: absolute;">
								<ul id="treeDemo" class="ztree"
									style="margin-top: 0; width: 180px; height: 100px;"></ul>
							</div>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td align="right">
							岗位名称:
						</td>
						<td align="left">
							<input type="text" id="username" name="userPO.username"
								class="validate[required] text-input" maxlength="128"></input>
							<font color="red">*</font>
						</td>
						<td align="right">
							隶属机构:
						</td>
						<td align="left">
							<input id="deptid_add" type="text" readonly="readonly" size="20" onclick="showMenu_dept_add();" />
							<div id="dept_menuContent_add" class="dept_menuContent_add"
								style="display: none; position: absolute;">
								<ul id="dept_treeDemo_add" class="ztree"
									style="margin-top: 0; width: 180px; height: 100px;"></ul>
							</div>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td align="right">
							岗位级别:
						</td>
						<td align="left">
							<select>
								<option value="0">
									来自岗位级别字典
								</option>
								<option value="1">
									中层
								</option>
								<option value="2">
									高层
								</option>
							</select>
							<font color="red">*</font>
						</td>
						<td align="right">
							岗位性质:
						</td>
						<td align="left">
							<select>
								<option value="0">
									来自岗位性质字典
								</option>
								<option value="1">
									销售
								</option>
								<option value="2">
									研发
								</option>
							</select>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td align="right">
							创建日期:
						</td>
						<td align="left">
							<ui:datepicker id="createdate" />
						</td>
						<td align="right">
							岗位状态:
						</td>
						<td align="left">
							<select>
								<option value="1">
									正常
								</option>
								<option value="0">
									注销
								</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">
							岗位备注:
						</td>
						<td align="left" colspan="3">
							<textarea cols="50" rows="4" id="" name=""></textarea>
						</td>
					</tr>
					<tr>
						<td align="right" colspan="2">
							<input type="button" value="保存" class="button_image" id="add" />
						</td>
						<td align="left" colspan="2">
							<input type="reset" value="重置" class="button_image" />
						</td>
					</tr>
				</table>
			</form>
		</ui:dialog>
		<ui:dialog id="role_update" title="岗位信息编辑" height="270" width="600"
			modal=true>
			<form id="uform"
				action="/eaip/webservice/resources/session/login"
				method="post">
				<table class="table_frame" width="100%">
					<tr>
						<td align="right">
							岗位编号:
						</td>
						<td align="left">
							<input type="text" id="username" name="userPO.username"
								class="validate[required] text-input" maxlength="128"></input>
							<font color="red">*</font>
						</td>
						<td align="right">
							上级岗位:
						</td>
						<td align="left">
							<input id="parent_update" type="text" readonly="readonly"
								size="20" onclick="showMenu_update();" />
							<div id="menuContent_update" class="menuContent_update"
								style="display: none; position: absolute;">
								<ul id="treeDemo_update" class="ztree"
									style="margin-top: 0; width: 180px; height: 100px;"></ul>
							</div>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td align="right">
							岗位名称:
						</td>
						<td align="left">
							<input type="text" id="username" name="userPO.username"
								class="validate[required] text-input" maxlength="128"></input>
							<font color="red">*</font>
						</td>
						<td align="right">
							隶属机构:
						</td>
						<td align="left">
							<input id="deptid_update" type="text" readonly="readonly"
								size="20" onclick="showMenu_dept_update();" />
							<div id="dept_menuContent_update" class="dept_menuContent_update"
								style="display: none; position: absolute;">
								<ul id="dept_treeDemo_update" class="ztree"
									style="margin-top: 0; width: 180px; height: 100px;"></ul>
							</div>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td align="right">
							岗位级别:
						</td>
						<td align="left">
							<select>
								<option value="0">
									来自岗位级别字典
								</option>
								<option value="1">
									中层
								</option>
								<option value="2">
									高层
								</option>
							</select>
							<font color="red">*</font>
						</td>
						<td align="right">
							岗位性质:
						</td>
						<td align="left">
							<select>
								<option value="0">
									来自岗位性质字典
								</option>
								<option value="1">
									销售
								</option>
								<option value="2">
									研发
								</option>
							</select>
							<font color="red">*</font>
						</td>
					</tr>
					<tr>
						<td align="right">
							创建日期:
						</td>
						<td align="left">
							<ui:datepicker id="createdate" />
						</td>
						<td align="right">
							岗位状态:
						</td>
						<td align="left">
							<select>
								<option value="1">
									正常
								</option>
								<option value="0">
									注销
								</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">
							岗位备注:
						</td>
						<td align="left" colspan="3">
							<textarea cols="50" rows="4" id="" name=""></textarea>
						</td>
					</tr>
					<tr>
						<td align="right" colspan="2">
							<input type="button" value="保存" class="button_image" id="update" />
						</td>
						<td align="left" colspan="2">
							<input type="reset" value="重置" class="button_image" />
						</td>
					</tr>
				</table>
			</form>
		</ui:dialog>
		
		<ui:dialog id="func_auth" title="角色功能授权" height="300" width="600"
			modal=true>
			<form id="uform"
				action="/eaip/webservice/resources/session/login"
				method="post">
				<table class="table_frame" width="80%">
					<tr>
						<td colspan="2">
							<div> 
								<ul id="func_treeDemo_auth" class="ztree"></ul> 
							</div> 
						</td>
					</tr>
					<tr>
						<td align="right">
							<input type="button" value="授权" class="button_image" id="btn_auth" />
						</td>
						<td align="left">
							<input type="reset" value="重置" class="button_image" />
						</td>
					</tr>
				</table>
			</form>
		</ui:dialog>
	</body>
</html>
